<template>
    <div class="auth-layout">
      <!-- 背景装饰 -->
      <div class="background">
        <div class="circle circle-1"></div>
        <div class="circle circle-2"></div>
        <div class="circle circle-3"></div>
      </div>
      
      <!-- 卡片容器 -->
      <div class="card-container">
        <!-- 卡片头部 -->
        <div class="card-header">
          <div class="logo">
            <i class="fas fa-shield-alt"></i>
            <span>安全认证平台</span>
          </div>
          <h1>{{ currentPageTitle }}</h1>
          <p>{{ currentPageDescription }}</p>
        </div>
        
        <!-- 卡片主体 - 路由视图 -->
        <div class="card-body">
          <router-view></router-view>
        </div>
        
        <!-- 卡片底部 - 切换链接 -->
        <div class="card-footer">
          <div class="switch-link">
            {{ isLoginPage ? '还没有账户?' : '已有账户?' }}
            <router-link :to="isLoginPage ? '/register' : '/login'">
              {{ isLoginPage ? '立即注册' : '返回登录' }}
            </router-link>
          </div>
        </div>
      </div>
      
    
    </div>
  </template>
  
  <script>
  import { computed } from 'vue';
  import { useRoute } from 'vue-router';
  
  export default {
    name: 'AuthLayout',
    setup() {
      const route = useRoute();
      
      // 计算当前页面信息
      const isLoginPage = computed(() => route.path === '/login');
      
      const currentPageTitle = computed(() => 
        isLoginPage.value ? '用户登录' : '用户注册'
      );
      
      const currentPageDescription = computed(() => 
        isLoginPage.value 
          ? '欢迎回来，请登录您的账户' 
          : '创建新账户，开启您的旅程'
      );
      
      return {
        isLoginPage,
        currentPageTitle,
        currentPageDescription
      };
    }
  }
  </script>
  
  <style scoped>
  /* 基础样式 */
  .auth-layout {
    position: relative;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    overflow: hidden;
  }

  
  /* 通用卡片样式 */
  .card-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
  }
  
  .card-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  }
  
  .card-header {
    padding: 30px 30px 20px;
    background: linear-gradient(135deg, #4776E6 0%, #8E54E9 100%);
    color: white;
    text-align: center;
  }
  
  .logo {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    margin-bottom: 15px;
  }
  
  .card-header h1 {
    margin-bottom: 8px;
    font-size: 28px;
    font-weight: 600;
  }
  
  .card-header p {
    opacity: 0.9;
    font-size: 16px;
  }
  
  .card-body {
    padding: 30px;
  }
  
  .card-footer {
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
  }
  
  .switch-link {
    color: #666;
  }
  
  .switch-link a {
    color: #4776E6;
    text-decoration: none;
    font-weight: 500;
    margin-left: 8px;
    transition: color 0.3s;
  }
  
  .switch-link a:hover {
    color: #3559c7;
    text-decoration: underline;
  }
  
 
  

  </style>